
function user_lightning(){
    this.speed = 8;
    this.atk=0.5
    this.top = 0;
    this.left = 0;
    this.max_width = 0;
    this.width = 10;
    this.height = 800;
    this.style=0
    this.animate=[document.getElementById("lightning"),document.getElementById("lightning2"),document.getElementById("lightning3"),document.getElementById("lightning4")]
    this.create = () => {
      this.dom = document.getElementById("lightning");
      this.top = user_plan1.top - 600;
    };
  }

  function wingman(){
    this.top = 0;
    this.left = 0;
    this.width=186;
    this.height=58;
    this.cooling=0
    this.create = () => {
      this.dom = document.getElementById("wingman");
      this.top = user_plan1.top
      this.left = user_plan1.left+user_plan1.width/2-93;
      this.ready()
    };
    this.ready=()=>{
      
      for(let i=0;i<=1;i++){
        let user_lightning1=new user_lightning()
        user_lightning1.create()
        user_lightning_list.push(user_lightning1)
        if(i){
          user_lightning1.left=wingman.left+10
        }else{
          user_lightning1.left=wingman.left+wingman.width-10
        }
        
      }
    }

  }
  function red_wingman(){
    this.style="red_mingman"
    this.width=20
    this.height=21
    this.top=null
    this.left=null
    this.cooling=10
    this.index=null
    this.dom=document.getElementById('red_wingman')
    this.run=(user_plane)=>{
      this.left=this.index?user_plane.left-10-this.width*2:user_plane.left+user_plane.width+10+this.width
      this.top=user_plane.top+user_plane.height-this.height
      this.cooling--
      if(this.cooling<=0){
        //atk
        create_wingman_atk(this.style,this.left+this.width/2,this.top)
        this.cooling=10
      }
    }
  }
  function laser(left,top){
    this.speed = 100;
    this.atk=2
    this.width = 10;
    this.height = 100;
    this.top = top-this.height;
    this.left = left-this.width/2;
    this.style='laser'
    this.dom=document.getElementById('laser')
    this.move=()=>{
      this.top-=this.speed
    }
  }
  function create_wingman_atk(style,left,top){
    switch(style){
      case "red_mingman":
        let bullet =new laser(left,top)
        wingman_bullet.push(bullet)
        break
  }
}
export var wingman_list=[]
export var wingman_bullet=[]
export {red_wingman}